Skip to content

support variables, that are passed instead of numbers#57

Open
AndrewChubatiuk wants to merge 1 commit intomasterfrom
parse-variables-in-expressions
Open

support variables, that are passed instead of numbers#57
AndrewChubatiuk wants to merge 1 commit intomasterfrom
parse-variables-in-expressions

Conversation

@AndrewChubatiuk
Copy link

@AndrewChubatiuk AndrewChubatiuk commented Oct 2, 2025

  • support variables, that are passed instead of numbers
  • add ParseWithVars, that preserves variables in expressions
  • add label_values function support to parse grafana queries

using library to properly modify metricsql expressions imported rules and dashboards here. while parsing metricsql expression in grafana dashboards it fails when:

  • unquoted variable is used as a function argument: histogram_quantile($quantile, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))
  • parsing expression, which contains grafana specific label_values function

@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 94.91525% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (8ec6569) to head (cb98770).

Files with missing lines Patch % Lines
parser.go 91.30% 1 Missing and 1 partial ⚠️
lexer.go 96.96% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #57      +/-   ##
==========================================
+ Coverage   89.69%   89.77%   +0.07%     
==========================================
  Files          11       11              
  Lines        2969     3011      +42     
==========================================
+ Hits         2663     2703      +40     
- Misses        209      210       +1     
- Partials       97       98       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AndrewChubatiuk AndrewChubatiuk force-pushed the parse-variables-in-expressions branch 4 times, most recently from 3f46c44 to 34e335c Compare October 3, 2025 06:58
@makasim makasim requested review from f41gh7 and makasim October 13, 2025 11:44
…pressions

Add `PrettifyExpr` that allows to return prettified string generated from existing expression
@AndrewChubatiuk AndrewChubatiuk force-pushed the parse-variables-in-expressions branch from 34e335c to cb98770 Compare February 16, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants